package com.starhub.api.auth.controller;

import com.starhub.api.auth.result.AuthInfoResult;
import com.starhub.api.auth.service.AuthService;
import com.starhub.common.bean.ResultResp;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 认证信息获取
 */
@Slf4j
@RestController
@RequestMapping("/api/starhub/auth")
public class AuthInfoController {

    @Autowired
    private AuthService authService;

    /**
     * 获取认证信息
     * @return
     */
    @GetMapping("/authInfo")
    public ResultResp<AuthInfoResult> getAuthInfo() {
        try {
            return ResultResp.success(authService.getAuthInfo());
        } catch (Exception e) {
            log.error("chat error", e);
             return ResultResp.fail(e.getMessage(),e);
        }
    }
}